package service;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import dao.ConvertRateDao;
import dao.impl.ConvertRateDaoImpl;
import domain.ClickTrend;
import domain.ConvertRate;

import java.util.List;

public class ConvertRateService {
    String valueAsString = null;
    private ConvertRateDao contacts = new ConvertRateDaoImpl();
    public String ToJson(ConvertRate convertRate) {
        String taskid = convertRate.getTaskid();
        List<ConvertRate> list = contacts.SelectConvertRate(taskid);
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            valueAsString = objectMapper.writeValueAsString(list);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
        return valueAsString;
    }
}
